package com.mia.props.common.entities;

import com.mia.props.common.TileProps;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;

public class TileMountable extends TileProps {
   public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float var7, float var8, float var9) {
      if (world.isRemote) {
         return true;
      } else {
         List list = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)(x + 1), (double)(y + 1), (double)(z + 1)));
         Iterator var11 = list.iterator();

         Entity entity;
         do {
            if (!var11.hasNext()) {
               EntityChairMount mount = new EntityChairMount(world);
               mount.setPosition((double)((float)x + 0.5F), (double)y, (double)z + 0.5D);
               player.mountEntity(mount);
               world.spawnEntityInWorld(mount);
               player.mountEntity(mount);
               return true;
            }

            entity = (Entity)var11.next();
         } while(!(entity instanceof EntityChairMount));

         return false;
      }
   }
}
